<?php
require_once( 'mafachi.ContentData.php' );
class ArticleData extends ContentData {
	protected static $tableName = "mafachi.article";
	protected static $tableID = "article_id";

	public function __construct() {
		parent::__construct();
		$this->field[ "source" ] = null;
		$this->field[ "writer" ] = null;
	}
	public function add() {
		static::$queryStr = "insert into article values( '', '', now(), now(), 0, 0, '".$this->field[ "source" ];
		static::$queryStr.= "','".$this->field[ "writer" ]."','".$this->field[ "title" ]."','".$this->field[ "content" ]."')";
		return parent::add();
	}
	public function update() {		
		static::$queryStr = "update article set edit_time = now(), source='".$this->field[ "source" ]."',";
		static::$queryStr.= "writer='".$this->field[ "writer" ]."', title='".$this->field[ "title" ];
		static::$queryStr.= "',content='".$this->field[ "content" ]."' where article_id=".$this->field[ "article_id" ];
		return parent::update();
	}
}
?>